package dom;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;

public class ParseXMLFile {
	public static void main(String[] args) throws Exception{
		Document doc = new SAXBuilder(false).build(new FileInputStream("Customer.xml"));
		Element root = doc.getRootElement();
		System.out.println("root:"+root.getName());
		
		List<Element> cs = root.getChildren();
		for(Element e:cs){
			String id = e.getAttribute("id").getValue();
			String name = e.getChild("name").getText();
			String age = e.getChild("age").getTextTrim();
			System.out.println(id+"\t"+name+"\t"+age);
		}
	}

}
